<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title>运营平台</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="renderer" content="webkit">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/common.css?v=20170207" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/table.css?v=20170117" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/jquery-ui.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-1.11.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ui.min.js" type="text/javascript"></script>
 <script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/yunIndex.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ym-datePlugin-0.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/global.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/cheshan/js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery.placeholder.min.js"></script>
<script type="text/javascript">
 $(function(){
     $("input").placeholder();
     if (navigator.userAgent.indexOf("Safari") > -1) {
       $("input").css("lineHeight","normal !important");
     };
});
</script>

<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/plugin/select2/select2.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<script src="http://img1.isou365.cn/paimai/yunying/js/city.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/webuploader.min.js"></script>
<!--<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/upload.js"></script>-->
<style>
    .xuanzhe ul li .menDao1{width:300px;}
    .xuanzhe ul li .menDao1 a{display:block;background:#cecece;color:#303030;float:left;width:36px; text-align:center;height:20px; line-height:20px; cursor:pointer;}
    .xuanzhe ul li .menDao1 .menHover{ background:#20ab4f;color:#fff;}
</style>
<body>
<div class="header">
<div class="headerCo">
<span>你好,<?php echo ($user_info["real_name"]); ?><a href="<?php echo (WEB_URL); ?>Emp/logout">退出</a></span>
<h1><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_logo.jpg"></h1>
</div>
</div>
<div class="mian">
    <div class="mianL">
    <dl>
        <dd>
            <a id="menu_sy" href="/Index/index" class="shouye">首页</a>
        </dd>
        <?php foreach ($tree_menu as $key => $value): ?>
          <dd>
            <span id="menu_<?php echo ($value['first_char']); ?>" ><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_jia.jpg"><?php echo ($value['name']); ?></span>
            <ul style="display: none;">
                <?php if (!empty($value['children'])): ?>
                    <?php foreach ($value['children'] as $k => $v): ?>
                        <li><a id='menu_<?php echo ($v["first_char"]); ?>' href="<?php echo ($v['url']); ?>"><?php echo ($v['name']); ?></a></li>
                    <?php endforeach ?>
                <?php endif ?>
            </ul>
        <?php endforeach ?>
    </dl>
</div>

<?php $menu = 'shgl.sxsc'; ?>
<?php $menu=json_encode(explode('.', $menu)); ?>
<script>
    $(function () {
        var cur_menu = '<?php echo ($menu); ?>', cur_menu = eval('[' + cur_menu + ']'), cur_menu = cur_menu[0];
        if (cur_menu == "sy") {
            $("#menu_sy").removeClass('shouye').addClass('current');
        }
        $('#menu_' + cur_menu[0]).click();
        $('#menu_' + cur_menu[0]).find("img").attr("src", "http://img1.isou365.cn/paimai/yunying/images/yun_jie.jpg");
        $(".mianL").css("height", $(document).height() - 95);
        $('#menu_' + cur_menu[1]).addClass('current');
    });
</script>
    <div class="mianR">
        <div class="listBox">
                <h3 class="cha">手续上传</h3>
            <div class="car_info">
                    <div class="car_no"><span style="font-size:14px;">车辆编号：<b><?php echo ($detail["sno"]); ?></b></span></div>

                    <table border="1" width="100%">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>车主信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">车主姓名</td>
                            <td width="39%"><?php echo ($detail["seller_name"]); ?></td>
                            <td width="11%" style="color:#898b8a;">联系电话</td>
                            <td colspan="3"><?php echo ($detail["phone"]); ?></td>
                        </tr>
                        </tbody>
                    </table>

                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                                    <span>车辆信息</span>
                                    <span style="float: right;margin-right: 20px;"><a style="color: #0000FF;text-decoration: underline;" href="/Car/report/car_id/<?php echo ($detail["car_id"]); ?>" target="_blank">检测报告</a></span>
                                </td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">车型</td>
                                <td width="39%"><?php echo ($detail["model"]); ?></td>
                                <td width="11%" style="color:#898b8a;">排放标准</td>
                                <td width="39%"><?php echo ($detail["emission"]); ?></td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">初登日期</td>
                                <td><?php echo ($detail["first_reg_date"]); ?></td>
                                <td style="color:#898b8a;">颜色</td>
                                <td><?php echo ($detail["car_color"]); ?></td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">表显里程</td>
                                <td><?php echo ($detail["pointer_mileage"]); ?>万公里</td>
                                <td style="color:#898b8a;">车况级别</td>
                                <td><?php echo ($detail["composite_state"]); echo ($detail["accident_level"]); ?></td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">车辆注册地</td>
                                <td><?php echo ($detail["first_reg_city"]); ?></td>
                                <td style="color:#898b8a;">车架号</td>
                                <td><?php echo ($detail["vin"]); ?></td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">过户限制</td>
                                <td><?php echo ($detail["transfer_limit"]); ?></td>
                                <td style="color:#898b8a;">车牌号</td>
                                <td><?php echo ($detail["plate_prefix"]); echo ($detail["plate_suffix"]); ?></td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">渠道来源</td>
                                <td>
                                    <?php if($detail["comefrom"] != ''): if(empty($detail['comefrom_url'])):?>
                                        <?php echo ($detail["comefrom"]); ?>
                                        <?php else: ?>
                                        <a href="<?php echo ($detail["comefrom_url"]); ?>" target="_blank" rel="noreferrer"><?php echo ($detail["comefrom"]); ?></a>
                                        <?php endif;?>
                                        <?php else: ?>
                                        未知<?php endif; ?>
                                </td>
                                <td style="color:#898b8a;">所在地</td>
                                <td><?php echo ($detail["location_area"]); ?></td>
                            </tr>
                        </tbody>
                    </table>

                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                            <span>过户信息</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">车辆落户</td>
                        <td width="39%"><?php echo ($detail["transfer_to"]); ?></td>
                        <td width="11%" style="color:#898b8a;">开票要求</td>
                        <td width="39%"><?php echo ($detail["invoice"]); ?>元</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">过户要求</td>
                        <td><?php echo ($detail["transfer_type"]); ?></td>
                        <td style="color:#898b8a;">过户成功时间</td>
                        <td><?php echo ($detail["created_time"]); ?></td>
                    </tr>
                    </tbody>
                </table>

            </div>

            <?php if($status == 1):?>
                <div class="car_info">
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                                <span>手续信息</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">上传人</td>
                            <td width="39%"><?php echo ($detail["emp_name"]); ?></td>
                            <td width="11%" style="color:#898b8a;">上传完成时间</td>
                            <td width="39%"><?php echo ($detail["upload_time"]); ?></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            <?php endif;?>

            <h3 class="cha">手续上传要求</h3>
            <div class="transfer-want">
                <div class="transfer-front clearfix">
                    <dl class="clearfix" style="height: 310px;">
                        <dt style="height: 310px;">
                            <span style="margin-top: 134px;">过户前</span>
                        </dt>
                        <?php if(empty($beforeTransfer)): ?><dd class="not-upload">无上传要求</dd><?php endif; ?>
                        <dd>
                            <ul >
                                <?php foreach($beforeTransfer as $pb):?>
                                <li data-id="1" class="clearfix">
                                    <span><?php echo ($pb["certificate_name"]); ?></span>
                                    <input type="button" class="<?php echo ($pb['certificate_image_type']==1 || $pb['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="1" value="照片" >
                                    <input type="button" class="<?php echo ($pb['certificate_image_type']==2 || $pb['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="2" value="扫描件">
                                </li>
                                <?php endforeach;?>
                            </ul>
                        </dd>
                    </dl>
                    <dl class="clearfix" style="margin-left:24px;">
                        <dt style="height: 310px;"><span style="margin-top: 134px;">过户后</span></dt>
                        <?php if(empty($afterTransfer)): ?><dd class="not-upload">无上传要求</dd><?php endif; ?>
                        <dd>
                            <ul>
                                <?php foreach($afterTransfer as $pa):?>
                                <li data-id="2" class="clearfix">
                                    <span><?php echo ($pa["certificate_name"]); ?></span>
                                    <input type="button" class="<?php echo ($pa['certificate_image_type']==1 || $pa['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="1" value="照片" >
                                    <input type="button" class="<?php echo ($pa['certificate_image_type']==2 || $pa['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="2" value="扫描件">
                                </li>
                                <?php endforeach;?>
                            </ul>
                        </dd>
                    </dl>
                </div>
            </div>

            <!--<h3 class="cha">手续上传要求</h3>
            <div class="transfer-want">
                <div class="transfer-front clearfix">
                    <dl class="clearfix">
                        <dt><span>过户前</span></dt>
                        <dd>
                            <ul>
                                <li class="clearfix">
                                    <span>原行驶本</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>原登记证</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>车主身份证</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>原购车发票/过户票</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                            </ul>
                        </dd>
                    </dl>
                    <dl class="clearfix" style="margin-left:25px;">
                        <dt><span>过户前</span></dt>
                        <dd>
                            <ul>
                                <li class="clearfix">
                                    <span>变更后行驶本</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>变更后登记证</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>买方身份证</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>过户票/过户票</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>车架号合影</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>交档回执单</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>档案袋</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                                <li class="clearfix">
                                    <span>临时牌照</span>
                                    <input type="button" value="照片" />
                                    <input type="button" value="扫描件" />
                                </li>
                            </ul>
                        </dd>
                    </dl>
                </div>
            </div>-->

            <h3 class="cha">过户前手续上传</h3>
            <div class="transfer-front-pic clearfix" id="transfer1">
                <div class="transfer-front-list">
                    <ul class="clearfix">
                        <?php if(is_array($detail["before_transfer_procedures"])): foreach($detail["before_transfer_procedures"] as $key=>$procedures): if($key == 0): ?><li class="current" value="<?php echo ($procedures["id"]); ?>"><?php echo ($procedures["value"]); ?></li>
                                <?php else: ?>
                                <li value="<?php echo ($procedures["id"]); ?>"><?php echo ($procedures["value"]); ?></li><?php endif; endforeach; endif; ?>
                    </ul>
                </div>
                <div class="transfer-front-content">
                    <div class="transfer-front-tu">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 1): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>

                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 2): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 3): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 4): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                </div>
                <div class="transfer-front-btn">
                    <span class="transfer-btn-ico">批量上传</span>
                </div>
            </div>
            <h3 class="cha">过户后手续上传</h3>
            <div class="transfer-front-pic clearfix" id="transfer2">
                <div class="transfer-front-list">
                    <ul class="clearfix">
                        <?php if(is_array($detail["after_transfer_procedures"])): foreach($detail["after_transfer_procedures"] as $key=>$procedures): if($key == 0): ?><li class="current1" value="<?php echo ($procedures["id"]); ?>"><?php echo ($procedures["value"]); ?></li>
                            <?php else: ?>
                                <li value="<?php echo ($procedures["id"]); ?>"><?php echo ($procedures["value"]); ?></li><?php endif; endforeach; endif; ?>
                       <!-- <li class="current1">原行驶证</li><li>原登记证</li><li>车主身份证</li><li>原购车发票/原过户票</li>-->
                    </ul>
                </div>
                <div class="transfer-front-content">
                    <div class="transfer-front-tu">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 5): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 6): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 7): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 8): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 9): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 10): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 11): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                    <div class="transfer-front-tu" style="display:none;">
                        <ul class="clearfix">
                            <?php if(is_array($detail["proceduresFile"])): foreach($detail["proceduresFile"] as $key=>$procedures_image): if($procedures_image['certificate_id'] == 12): ?><li><img src="<?php echo ($detail["host"]); echo ($procedures_image["url"]); ?>" data_id="<?php echo ($procedures_image['id']); ?>" data_url="<?php echo ($procedures_image["url"]); ?>"><span>×</span></li><?php endif; endforeach; endif; ?>
                            <li></li>
                        </ul>
                    </div>
                </div>
                <div class="transfer-front-btn">
                    <span class="transfer-btn-ico">批量上传</span>
                </div>
            </div>

            <div class="yongBtn">
                <?php if($status == 0): ?><input id="submitForm" type="button" value="上传完成" name="queding" class="queding">
                    <input type="button" onclick="window.close();" class="quxiao" value="下次续传">
                <?php else: ?>
                    <input type="button" value="确认更新" name="queding" class="queding">
                    <input type="button" onclick="window.close();" class="quxiao" value="取消"><?php endif; ?>
            </div>
        </div>
</div>
<!--图片批量上传功能-->

    <div id="uploader" class="uploader">
        <div class="queueList clearfix">
            <div id="dndArea" class="placeholder">
                <div id="filePicker"></div>
            </div>
        </div>
        <div class="statusBar">
            <div class="progress">
                <span class="text">0%</span>
                <span class="percentage"></span>
            </div><div class="info"></div>
            <div class="btns">
                <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="http://img1.isou365.cn/paimai/yunying/js/jquery.rotate.min.js"></script>

    <div class="sunbox-alret">
        <img src="" />

    </div>
    <div class="xuanzhuan"></div>
    <div class="xie-loading"></div>
    <div class="fork1"></div>
<div class="fork"></div>
<div class="yunBei"></div>

    <script>

    $(document).ready(function(){
        $(".transfer-front-tu ul li img").click(function(){
            var Img=$(this).attr("src").split("@");
            $(".xuanzhuan").fadeIn();
            $(".fork1").fadeIn();
            $(".yunBei").css("display","block");
            $(".xie-loading").fadeIn();

            $(".sunbox-alret img").attr("src",Img[0]).get(0).onload=function(){
                $(".sunbox-alret").fadeIn();
                $(".sunbox-alret").rotate(0);
                $(".xie-loading").fadeOut();
                $(".sunbox-alret").css("top",$(window).scrollTop());
                $(".sunbox-alret").css({
                    "marginTop":100,
                    "marginLeft":-$(".sunbox-alret").outerWidth()/2
                })
            };
        })
        var tmp = 0;
        $(function(){
            $(".xuanzhuan").click(function(){
                tmp ++;
                $(".sunbox-alret").rotate(90*tmp);
            })
        })

        $(".fork1").click(function(){
            $(".yunBei").css("display","none");
            $(".sunbox-alret").fadeOut();
            $(".xuanzhuan").fadeOut();
            $(".fork1").fadeOut();
            $(".xie-loading").fadeOut();
            $(".sunbox-alret img").attr("src","");
            tmp = 0;
        })


        //新加的js功能效果
        //新加的js功能效果
        var oH=$(".transfer-front dl:last-of-type").outerHeight();
        $(".transfer-front dl:first-child").css("height",oH+"px");
        $(".transfer-front dl dt").css("height",oH+"px");
        var oSh=$(".transfer-front dl dt span").height();
        $(".transfer-front dl dt span").css("marginTop",(oH-oSh)/2+"px");

       /* $(".transfer-front dl dd ul li input").on("click",function(){
            $(this).toggleClass("current");
        })*/

        //Upload(num);
        $("#transfer1 .transfer-front-list ul li").on("click",function(){
            $("#transfer1 .transfer-front-list ul li").removeClass("current");
            $(this).addClass("current");
            var index=$("#transfer1 .transfer-front-list ul li").index(this);
            $("#transfer1 .transfer-front-tu").eq(index).show().siblings().hide();
        })

        $("#transfer2 .transfer-front-list ul li").on("click",function(){
            $("#transfer2 .transfer-front-list ul li").removeClass("current1");
            $(this).addClass("current1");
            var index=$("#transfer2 .transfer-front-list ul li").index(this);
            $("#transfer2 .transfer-front-tu").eq(index).show().siblings().hide();
        })
        $("#transfer1 .transfer-front-btn .transfer-btn-ico").click(function(){
            Upload();
            $(".uploader").fadeIn();
            $(this).attr("id","batch1");
            var oH=$(".uploader").outerHeight();
            $(".uploader").css("marginTop",-oH/2+"px");
            $(".fork").css("display","block");
            $(".uploader").css("zIndex",99999);
            $(".yunBei").css("display","block");
            $(".shibai").css("zIndex",9999999);

        })
        $("#transfer2 .transfer-front-btn .transfer-btn-ico").click(function(){
            Upload();
            $(".uploader").fadeIn();
            $(this).attr("id","batch2");
            var oH=$(".uploader").outerHeight();
            $(".uploader").css("marginTop",-oH/2+"px");
            $(".fork").css("display","block");
            $(".uploader").css("zIndex",99999);
            $(".yunBei").css("display","block");
            $(".shibai").css("zIndex",9999999);

        })

        $(".fork").on("click",function(){
            $(".uploader").fadeOut();
            $(".yunBei").css("display","none");
            $(this).css("display","none");
            $("#transfer2 .transfer-front-btn .transfer-btn-ico").removeAttr("id");
            $("#transfer1 .transfer-front-btn .transfer-btn-ico").removeAttr("id");
            $(".filelist li").remove();
        })

        $(".transfer-front-tu").on("click","ul li span",function(){
            $(this).parents("ul").find("li img").removeAttr("img");
            var id = $(this).parents("li").find("img").attr("data_id");
            var url = $(this).parents("li").find("img").attr("data_url");
            deleteImg(id,url);
            //alert(aID);
            if($(this).parents("ul").find("li").length>2){
                $(this).parents("ul").find("li:last-of-type").hide();
            }else{
                $(this).parents("ul").find("li:last-of-type").show();
            }
            $(this).parent("li").remove();
        })

        $(".transfer-front-tu").each(function(){
            if($(this).find("ul li").length>1){
                $(this).find("ul li:last-of-type").hide();
            }
        })




        $('[name=queding]').click('click',submit);

        $(".shenhei-btn .cancel").on("click",function(){
            $(".review-alert #recheck_time1").val("");
            $(".review-alert textarea").val("");
            $(".review-alert").fadeOut();
            $(".yunBei").css("display","none");
        })
    });

    /**
     * 提交
     **/
    function submit() {
            var postData = {};
            var url='';
            postData.id = "<?php echo $detail['id'];?>";
            postData.order_id = "<?php echo $detail['order_id'];?>";
            url='/Procedures/save';

            $(".yunBei").css("display",'block').unbind('click');
            $(".loading").fadeIn();
            $.post(url,postData,function(data) {
                if(data.code!=200){
                    shibai_alert(data.msg,1500);
                    $(".loading").fadeOut();
                    $(".yunBei").css("display",'none')
                    return false;
                }
                btn_alert("操作成功",1500,function () {
                    window.location.href="/Procedures/index";
                });
            },'json');
    }

    function deleteImg(id,image_url) {
        var postData = {};
        postData.img_id = id;
        postData.image_url = image_url;
        postData.order_id = "<?php echo $detail['order_id'];?>";
        url='/Procedures/deleteImg';

        $(".loading").fadeOut();
        $(".yunBei").css("display",'none');

        $.post(url,postData,function(data) {
            if(data.code!=200){
                shibai_alert(data.msg,1500);
                $(".loading").fadeOut();
                $(".yunBei").css("display",'none')
                return false;
            }
            btn_alert("操作成功",1500);
        },'json');
    }




    function Upload(){
        var $wrap = $('#uploader'),
                // 图片容器
                $queue = $('<ul class="filelist"><li></li></ul>')
                        .appendTo($wrap.find('.queueList')),
                // 状态栏，包括进度和控制按钮
                $statusBar = $wrap.find('.statusBar'),
                // 文件总体选择信息。
                $info = $statusBar.find('.info'),
                // 上传按钮
                $upload = $wrap.find('.uploadBtn'),
                // 没选择文件之前的内容。
                $placeHolder = $wrap.find('.placeholder'),
                $progress = $statusBar.find('.progress').hide(),
                // 添加的文件数量
                fileCount = 0,
                // 添加的文件总大小
                fileSize = 0,
                // 优化retina, 在retina下这个值是2
                ratio = window.devicePixelRatio || 1,
                // 缩略图大小
                thumbnailWidth = 180 * ratio,
                thumbnailHeight = 120 * ratio,
                // 可能有pedding, ready, uploading, confirm, done.
                state = 'pedding',
                // 所有文件的进度信息，key为file id
                percentages = {},
                // 判断浏览器是否支持图片的base64
                isSupportBase64 = (function () {
                    var data = new Image();
                    var support = true;
                    data.onload = data.onerror = function () {
                        if (this.width != 1 || this.height != 1) {
                            support = false;
                        }
                    }
                    data.src = "";
                    return support;
                })(),
                // 检测是否已经安装flash，检测flash的版本
                flashVersion = (function () {
                    var version;
                    try {
                        version = navigator.plugins[ 'Shockwave Flash' ];
                        version = version.description;
                    } catch (ex) {
                        try {
                            version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash')
                                    .GetVariable('$version');
                        } catch (ex2) {
                            version = '0.0';
                        }
                    }
                    version = version.match(/\d+/g);
                    return parseFloat(version[ 0 ] + '.' + version[ 1 ], 10);
                })(),
                supportTransition = (function () {
                    var s = document.createElement('p').style,
                            r = 'transition' in s ||
                                    'WebkitTransition' in s ||
                                    'MozTransition' in s ||
                                    'msTransition' in s ||
                                    'OTransition' in s;
                    s = null;
                    return r;
                })(),
                // WebUploader实例
                uploader;

        if (!WebUploader.Uploader.support('flash') && WebUploader.browser.ie) {

            // flash 安装了但是版本过低。
            if (flashVersion) {
                (function (container) {
                    window['expressinstallcallback'] = function (state) {
                        switch (state) {
                            case 'Download.Cancelled':
                                alert('您取消了更新！')
                                break;

                            case 'Download.Failed':
                                alert('安装失败')
                                break;

                            default:
                                alert('安装已成功，请刷新！');
                                break;
                        }
                        delete window['expressinstallcallback'];
                    };

                    var swf = './expressInstall.swf';
                    // insert flash object
                    var html = '<object type="application/' +
                            'x-shockwave-flash" data="' + swf + '" ';

                    if (WebUploader.browser.ie) {
                        html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
                    }

                    html += 'width="100%" height="100%" style="outline:0">' +
                            '<param name="movie" value="' + swf + '" />' +
                            '<param name="wmode" value="transparent" />' +
                            '<param name="allowscriptaccess" value="always" />' +
                            '</object>';

                    container.html(html);

                })($wrap);

                // 压根就没有安转。
            } else {
                $wrap.html('<a href="http://www.adobe.com/go/getflashplayer" target="_blank" border="0"><img alt="get flash player" src="http://www.adobe.com/macromedia/style_guide/images/160x41_Get_Flash_Player.jpg" /></a>');
            }

            return;
        } else if (!WebUploader.Uploader.support()) {
            alert('Web Uploader 不支持您的浏览器！');
            return;
        }

        // 实例化
        uploader = WebUploader.create({
            pick: {
                id: '#filePicker',
                label: '点击选择图片'
            },
            compress:false,//不压缩
            formData: {
                uid: 123,
                order_id: "<?php echo $detail['order_id']; ?>",
                order_no: "<?php echo $detail['order_no']; ?>",
                certificate_id: '',
            },
            dnd: '#dndArea',
            paste: '#uploader',
            swf: 'js/Uploader.swf',
            chunked: false,
            server: 'upload',
            accept:{
                title: 'Images',
                extensions: 'gif,jpg,jpeg,bmp,png',
                mimeTypes: 'image/*'
            },
            compress: {
                width: 5000,
                height: 5000,
                // 图片质量，只有type为`image/jpeg`的时候才有效。
                quality: 30,

                // 是否允许放大，如果想要生成小图的时候不失真，此选项应该设置为false.
                allowMagnify: false,

                // 是否允许裁剪。
                crop: false,

                // 是否保留头部meta信息。
                preserveHeaders: true,

                // 如果发现压缩后文件大小比原来还大，则使用原来图片
                // 此属性可能会影响图片自动纠正功能
                noCompressIfLarger: false,

                // 单位字节，如果图片大小小于此值，不会采用压缩。
                compressSize: 307200
            },

            // 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候，把图片打开。
            disableGlobalDnd: true,
            fileNumLimit: 10,
            fileSizeLimit: 200 * 1024 * 1024, // 200 M
            fileSingleSizeLimit: 50 * 1024 * 1024    // 50 M
        });

        // 拖拽时不接受 js, txt 文件。
        uploader.on('dndAccept', function (items) {
            var denied = false,
                    len = items.length,
                    i = 0,
                    // 修改js类型
                    unAllowed = 'text/plain;application/javascript ';

            for (; i < len; i++) {
                // 如果在列表里面
                if (~unAllowed.indexOf(items[ i ].type)) {
                    denied = true;
                    break;
                }
            }

            return !denied;
        });

        // uploader.on('filesQueued', function() {
        //     uploader.sort(function( a, b ) {
        //         if ( a.name < b.name )
        //           return -1;
        //         if ( a.name > b.name )
        //           return 1;
        //         return 0;
        //     });
        // });

        // 添加“添加文件”的按钮，
        uploader.addButton({
            id: '#filePicker2',
            label: '继续添加'
        });

        uploader.on('ready', function () {
            window.uploader = uploader;
        });

        // 当有文件添加进来时执行，负责view的创建
        function addFile(file) {
            var $li = $('<li id="' + file.id + '">' +
                            '<p class="title">' + file.name + '</p>' +
                            '<p class="imgWrap"></p>' +
                            '<p class="progress"><span></span></p>' +
                            '</li>'),
                    $btns = $('<div class="file-panel">' +
                            '<span class="cancel">×</span>').appendTo($li),
                    $prgress = $li.find('p.progress span'),
                    $wrap = $li.find('p.imgWrap'),
                    $info = $('<p class="error"></p>'),
                    showError = function (code) {
                        switch (code) {
                            case 'exceed_size':
                                text = '文件大小超出';
                                break;

                            case 'interrupt':
                                text = '上传暂停';
                                break;

                            default:
                                text = '上传失败，请重试';
                                break;

                        }

                        $info.text(text).appendTo($li);
                    };

            if (file.getStatus() === 'invalid') {
                showError(file.statusText);
            } else {
                // @todo lazyload
                $wrap.text('预览中');
                uploader.makeThumb(file, function (error, src) {
                    var img;

                    if (error) {
                        $wrap.text('不能预览');
                        return;
                    }

                    if (isSupportBase64) {
                        img = $('<img src="' + src + '"  alt="'+file.name+'">');
                        $wrap.empty().append(img);
                    } else {
                        $.ajax('../preview.php', {
                            method: 'POST',
                            data: src,
                            dataType: 'json'
                        }).done(function (response) {
                            if (response.result) {
                                img = $('<img src="' + response.result + '">');
                                $wrap.empty().append(img);
                            } else {
                                $wrap.text("预览出错");
                            }
                        });
                    }
                }, thumbnailWidth, thumbnailHeight);

                percentages[ file.id ] = [file.size, 0];
                file.rotation = 0;
            }

            file.on('statuschange', function (cur, prev) {
                if (prev === 'progress') {
                    $prgress.hide().width(0);
                } else if (prev === 'queued') {
                    $li.off('mouseenter mouseleave');
                    $btns.remove();
                }

                // 成功
                if (cur === 'error' || cur === 'invalid') {
                    console.log(file.statusText);
                    showError(file.statusText);
                    percentages[ file.id ][ 1 ] = 1;
                } else if (cur === 'interrupt') {
                    showError('interrupt');
                } else if (cur === 'queued') {
                    percentages[ file.id ][ 1 ] = 0;
                } else if (cur === 'progress') {
                    $info.remove();
                    $prgress.css('display', 'block');
                } else if (cur === 'complete') {
                    $li.append('<span class="success">×</span>');

                }

                $li.removeClass('state-' + prev).addClass('state-' + cur);
            });
            var $close_btn=$queue.find("span.success");
            $queue.on("click",$close_btn,function () {
                //uploader.removeFile(file);
                $(this).parents("li").find("li").remove();
                if($queue.find("li").length==1){
                    $queue.find("li").show();

                }
               // $queue.show();
            })

            $btns.on('click', 'span', function () {
                var index = $(this).index(),
                        deg;
                //alert($(this).parents("ul").find("li").length)
                if($(this).parents("ul").find("li").length==2){
                    $(this).parents("ul").find("li").show();

                }

                switch (index) {
                    case 0:
                        uploader.removeFile(file);
                        $(this).parents("ul").find("li").remove();
                        $queue.show();
                        return;

                    case 1:
                        file.rotation += 90;
                        break;

                    case 2:
                        file.rotation -= 90;
                        break;
                }

                if (supportTransition) {
                    deg = 'rotate(' + file.rotation + 'deg)';
                    $wrap.css({
                        '-webkit-transform': deg,
                        '-mos-transform': deg,
                        '-o-transform': deg,
                        'transform': deg
                    });
                } else {
                    $wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')');
                    // use jquery animate to rotation
                    // $({
                    //     rotation: rotation
                    // }).animate({
                    //     rotation: file.rotation
                    // }, {
                    //     easing: 'linear',
                    //     step: function( now ) {
                    //         now = now * Math.PI / 180;

                    //         var cos = Math.cos( now ),
                    //             sin = Math.sin( now );

                    //         $wrap.css( 'filter', "progid:DXImageTransform.Microsoft.Matrix(M11=" + cos + ",M12=" + (-sin) + ",M21=" + sin + ",M22=" + cos + ",SizingMethod='auto expand')");
                    //     }
                    // });
                }


            });

            $queue.prepend($li);
            var oH=$(".uploader").outerHeight();
            $(".uploader").css("marginTop",-oH/2+"px");
            if($queue.find("li").length>1){
                $queue.find("li:last-of-type").hide();
            }
        }

        // 负责view的销毁
        function removeFile(file) {
            var $li = $('#' + file.id);

            delete percentages[ file.id ];
            updateTotalProgress();
            $li.off().find('.file-panel').off().end().remove();
        }

        function updateTotalProgress() {
            var loaded = 0,
                    total = 0,
                    spans = $progress.children(),
                    percent;

            $.each(percentages, function (k, v) {
                total += v[ 0 ];
                loaded += v[ 0 ] * v[ 1 ];
            });

            percent = total ? loaded / total : 0;


            spans.eq(0).text(Math.round(percent * 100) + '%');
            spans.eq(1).css('width', Math.round(percent * 100) + '%');
            updateStatus();
        }

        function updateStatus() {
            var text = '', stats;

            if (state === 'ready') {
                text = '选中' + fileCount + '张图片，共' +
                        WebUploader.formatSize(fileSize) + '。';
            } else if (state === 'confirm') {
                stats = uploader.getStats();
                if (stats.uploadFailNum) {
                    text = '已成功上传' + stats.successNum + '张照片至XX相册，' +
                            stats.uploadFailNum + '张照片上传失败，<a class="retry" href="#">重新上传</a>失败图片或<a class="ignore" href="#">忽略</a>'
                }

            } else {
                stats = uploader.getStats();
                text = '共' + fileCount + '张（' +
                        WebUploader.formatSize(fileSize) +
                        '），已上传' + stats.successNum + '张';

                if (stats.uploadFailNum) {
                    text += '，失败' + stats.uploadFailNum + '张';
                }
            }

            $info.html(text);
        }

        function setState(val) {
            var file, stats;

            if (val === state) {
                return;
            }

            $upload.removeClass('state-' + state);
            $upload.addClass('state-' + val);
            state = val;

            switch (state) {
                case 'pedding':
                    $placeHolder.removeClass('element-invisible');
                    $queue.hide();
                    $statusBar.addClass('element-invisible');
                    uploader.refresh();
                    break;

                case 'ready':
                    $placeHolder.addClass('element-invisible');
                    $('#filePicker2').removeClass('element-invisible');
                    $queue.show();

                    $statusBar.removeClass('element-invisible');
                    uploader.refresh();
                    break;

                case 'uploading':
                    $('#filePicker2').addClass('element-invisible');
                    $progress.show();
                    $upload.text('暂停上传');
                    break;

                case 'paused':
                    $progress.show();
                    $upload.text('继续上传');
                    if($(".transfer-btn-ico").eq(0).attr("id")=="batch1"){
                        $("#transfer1 .transfer-front-list ul li").each(function(){
                            if($(this).hasClass("current")){
                                var index=$(this).index();
                                var certificate_id = $(this).attr("value");
                                // 初始化以后添加
                                uploader.options.formData.certificate_id = certificate_id;
                                $queue.find("li .imgWrap").each(function(){
                                    var oImg=$("#transfer1 .transfer-front-content .transfer-front-tu").eq(index).find("ul li img");
                                    for(var i=0;i<oImg.length;i++){
                                        if($(this).find("img").attr("src")==$(oImg[i]).attr("src")){
                                            $(".shibai").css("zIndex",9999999);
                                            shibai_alert1("文件名重复,请重新选择!");
                                            uploader.stop(true); //停止上传
                                            $progress.hide();
                                            return;
                                        }
                                    }
                                   /* $("#transfer1 .transfer-front-content .transfer-front-tu").eq(index).find("ul").prepend("<li>"+$(this).html()+"<span>×</span></li>");
                                    $("#transfer1 .transfer-front-tu").each(function(){
                                        if($(this).find("ul li").length>1){
                                            $(this).find("ul li:last-of-type").hide();
                                        }
                                    })*/
                                });
                            }
                        });
                    }

                    if($(".transfer-btn-ico").eq(1).attr("id")=="batch2"){
                        $("#transfer2 .transfer-front-list ul li").each(function(){
                            if($(this).hasClass("current1")){
                                var index=$(this).index();
                                var certificate_id = $(this).attr("value");
                                // 初始化以后添加
                                uploader.options.formData.certificate_id = certificate_id;
                                $queue.find("li .imgWrap").each(function(){
                                    var oImg=$("#transfer2 .transfer-front-content .transfer-front-tu").eq(index).find("ul li img");
                                    for(var i=0;i<oImg.length;i++) {
                                        if ($(this).find("img").attr("src") == $(oImg[i]).attr("src")) {
                                            $(".shibai").css("zIndex", 9999999);
                                            shibai_alert1("文件名重复,请重新选择!");
                                            uploader.stop(true);
                                            $progress.hide();
                                            return false;
                                        }
                                    }
                                   /* $("#transfer2 .transfer-front-content .transfer-front-tu").eq(index).find("ul").prepend("<li>"+$(this).html()+"<span>×</span></li>");
                                    $("#transfer2 .transfer-front-tu").each(function(){
                                        if($(this).find("ul li").length>1){
                                            $(this).find("ul li:last-of-type").hide();
                                        }
                                    })*/
                                });
                            }

                        });
                    }

                    break;

                case 'confirm':
                    $progress.hide();
                    $('#filePicker2').removeClass('element-invisible');
                    $upload.text('开始上传');

                    stats = uploader.getStats();
                    if (stats.successNum && !stats.uploadFailNum) {
                        setState('finish');
                        return;
                    }
                    break;
                case 'finish':
                    stats = uploader.getStats();
                    //console.log(stats);return;
                    if (stats.successNum) {
                       // alert('上传成功');
                    } else {
                        // 没有成功的图片，重设
                        state = 'done';
                        location.reload();



                    }
                    break;
            }

            updateStatus();
        }

        uploader.onUploadProgress = function (file, percentage) {
            //alert(file.name);
            var $li = $('#' + file.id),
                    $percent = $li.find('.progress span');

            $percent.css('width', percentage * 100 + '%');
            percentages[ file.id ][ 1 ] = percentage;
            updateTotalProgress();
        };

        uploader.onFileQueued = function (file) {
            fileCount++;
            if(fileCount==10){
                shibai_alert1("一次最多只能选择10个文件");
            }

            fileSize += file.size;

            if (fileCount === 1) {
                $placeHolder.addClass('element-invisible');
                $statusBar.show();
            }

            addFile(file);
            setState('ready');
            updateTotalProgress();
        };

        uploader.onFileDequeued = function (file) {
            fileCount--;
            fileSize -= file.size;

            if (!fileCount) {
                setState('pedding');
            }

            removeFile(file);
            updateTotalProgress();

        };

        uploader.onUploadSuccess = function (file,response) {
            if(response.code != 200){
                ///alert('444');
               // console.log(response);
                shibai_alert1(response.msg);
                return;
            }else{
                //console.log(response.data.pic)
                var url = response.data.pic;
                if($(".transfer-btn-ico").eq(0).attr("id")=="batch1"){
                    $("#transfer1 .transfer-front-list ul li").each(function(){
                        if($(this).hasClass("current")) {
                            var index = $(this).index();
                            $("#transfer1 .transfer-front-content .transfer-front-tu").eq(index).find("ul").prepend(
                                    "<li><img src=" +"'"+ url + "'"+" data_id=" + response.data.img_id + " data_url="+ "'"+ response.data.data_url + "'" +"><span>×</span></li>");

                            $("#transfer1 .transfer-front-tu").each(function(){
                                if($(this).find("ul li").length>1){
                                    $(this).find("ul li:last-of-type").hide();
                                }
                            })
                        }});
                }

                if($(".transfer-btn-ico").eq(1).attr("id")=="batch2"){
                    $("#transfer2 .transfer-front-list ul li").each(function(){
                        if($(this).hasClass("current1")){
                            var index=$(this).index();

                            $("#transfer2 .transfer-front-content .transfer-front-tu").eq(index).find("ul").prepend(
                                    "<li><img src=" +"'"+ url + "'"+" data_id=" + response.data.img_id + " data_url="+ "'"+ response.data.data_url + "'" +"><span>×</span></li>");

                            $("#transfer2 .transfer-front-tu").each(function(){
                                if($(this).find("ul li").length>1){
                                    $(this).find("ul li:last-of-type").hide();
                                }
                            })
                        }});
                }

                //console.log(response);return;
                //location.reload();

            }
        };

        uploader.onUploadFinished = function () { //当上传完成时
            $(".uploader").fadeOut();
            $(".yunBei").css("display","none");
            $(".fork").css("display","none");
            $(".filelist li").remove();
            //btn_alert("操作成功",1500);
            $("#transfer2 .transfer-front-btn .transfer-btn-ico").removeAttr("id");
            $("#transfer1 .transfer-front-btn .transfer-btn-ico").removeAttr("id");
        };

        uploader.on('all', function (type) {
            var stats;

            switch (type) {
                case 'uploadFinished':
                    setState('confirm');

                    break;
                case 'startUpload':
                    $progress.show();

                    if($(".transfer-btn-ico").eq(0).attr("id")=="batch1"){
                        $("#transfer1 .transfer-front-list ul li").each(function(){
                            if($(this).hasClass("current")){
                                var index=$(this).index();
                                var certificate_id = $(this).attr("value");
                                // 初始化以后添加
                                uploader.options.formData.certificate_id = certificate_id;
                                //uploader.formData.id = '555';
                                //uploader.formData.id = oId;
                                $queue.find("li .imgWrap").each(function(){

                                    if(!CheckStr($(this).find("img").attr("alt"))) {
                                        $(".shibai").css("zIndex", 9999999);
                                        shibai_alert1("文件名有特殊字符不能上传，请重新选择!");
                                        uploader.stop(true); //停止上传
                                        $progress.hide();
                                        return;
                                    }

                                    var oImg=$("#transfer1 .transfer-front-content .transfer-front-tu").eq(index).find("ul li img");
                                    for(var i=0;i<oImg.length;i++){

                                        var data_url = $(oImg[i]).attr("data_url");
                                        var file_name = data_url.replace(/.*(\/|\\)/, "");

                                        if($(this).find("img").attr("alt") == file_name){
                                            $(".shibai").css("zIndex",9999999);
                                            shibai_alert1("文件名重复,请重新选择!");
                                            uploader.stop(true); //停止上传
                                            $progress.hide();
                                            return;
                                        }
                                    }


                                });
                            }
                        });
                    }

                    if($(".transfer-btn-ico").eq(1).attr("id")=="batch2"){
                        $("#transfer2 .transfer-front-list ul li").each(function(){
                            if($(this).hasClass("current1")){
                                var index=$(this).index();
                                var certificate_id = $(this).attr("value");
                                // 初始化以后添加
                                uploader.options.formData.certificate_id = certificate_id;
                                $queue.find("li .imgWrap").each(function(){

                                    if(!CheckStr($(this).find("img").attr("alt"))) {
                                        $(".shibai").css("zIndex", 9999999);
                                        shibai_alert1("文件名有特殊字符不能上传，请重新选择!");
                                        uploader.stop(true); //停止上传
                                        $progress.hide();
                                        return;
                                    }

                                    var oImg=$("#transfer2 .transfer-front-content .transfer-front-tu").eq(index).find("ul li img");
                                    for(var i=0;i<oImg.length;i++) {
                                        var data_url = $(oImg[i]).attr("data_url");
                                        var file_name = data_url.replace(/.*(\/|\\)/, "");

                                        if($(this).find("img").attr("alt") == file_name){
                                            $(".shibai").css("zIndex", 9999999);
                                            shibai_alert1("文件名重复,请重新选择!");
                                            uploader.stop(true);
                                            $progress.hide();
                                            return false;
                                        }
                                    }
                                   /* $("#transfer2 .transfer-front-content .transfer-front-tu").eq(index).find("ul").prepend("<li>"+$(this).html()+"<span>×</span></li>");
                                    $("#transfer2 .transfer-front-tu").each(function(){
                                        if($(this).find("ul li").length>1){
                                            $(this).find("ul li:last-of-type").hide();
                                        }
                                    })*/
                                });
                            }

                        });
                    }

                    break;


                case 'stopUpload':
                    setState('paused');
                    break;

            }
        });

        uploader.onError = function (code) {

            $(".shibai").css("zIndex",9999999999999);
            shibai_alert1("文件名重复,请重新选择!");

        };

        $upload.on('click', function () {

            if ($(this).hasClass('disabled')) {
                return false;
            }

            if (state === 'ready') {
                uploader.upload();
            } else if (state === 'paused') {
                uploader.upload();
            } else if (state === 'uploading') {
                uploader.stop();
            }
        });



        $info.on('click', '.retry', function () {
            uploader.retry();
        });

        $info.on('click', '.ignore', function () {
            alert('todo');
        });

        $upload.addClass('state-' + state);

        updateTotalProgress();

    }

    function getFileName(o){
        var pos = o.lastIndexOf("\\");
        return o.substring(pos+1);
    }

    function CheckStr(str){
        var myReg = /^[^@\/\'\\\"#$%&\^\*]+$/;
        if(myReg.test(str)) return true;
        return false;
    }



</script>
<div class="yunBei"></div>
<div class="loading"></div>
</body>
</html>